<?php
/**
 * @see Zend_Controller_Action
 * @category   Pidguin
 * @package    Controller\Action
 */
class Pidguin_Controller_Action extends Zend_Controller_Action
{
	protected $_app = null;
	public function init()
	{
		$client = Pidguin_Client::getInstance();
		if ($client->isAccess($this->getRequest()) === false){
			throw new Exception('Access denied');
		}
		
		$this->_app = Pidguin_Application::getInstance();
		$this->view->client = Pidguin_Client::getInstance()->getClient();
	}
	
	protected function _disableLayout()
	{
		$this->_helper->layout()->disableLayout();
	}
	
	protected function _disableViewScript()
	{
		$this->_helper->viewRenderer->setNoRender();
	}
	
	protected function _disableView()
	{
		$this->_disableLayout();
		$this->_disableViewScript();
	}
	
	protected function isAjax()
	{
		return $this->getRequest()->isXmlHttpRequest();
	}
}